package com;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.common.utils.HttpClient5Utils;
import com.common.utils.StringUtil;
import com.entity.*;
import com.service.*;
import com.vo.SharesZjlx;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@SpringBootTest
@RunWith(SpringRunner.class)
public class NoticeDataDemo {

    @Autowired
    private SharesNoticeService sharesNoticeService;

    @Autowired
    private SharesDetailService sharesDetailService;

    @Autowired
    private SharesDirectionService sharesDirectionService;

    @Autowired
    private SharesSshyService sharesSshyService;

    @Autowired
    private SharesHyzxService sharesHyzxService ;

    @Autowired
    private SharesBgczService sharesBgczService;

    @Autowired
    private SharesGdnumService sharesGdnumService;

    @Autowired
    private SharesYjbgService sharesYjbgService ;

    @Autowired
    private SharesYjygService sharesYjygService;

    @Autowired
    private ShareHolderService shareHolderService;

    @Autowired
    private SharesGdChangeService sharesGdChangeService;

    @Autowired
    private SharesSsgnService sharesSsgnService;

    @Autowired
    private SharesGnService sharesGnService;

    /**
     * 个股公告
     */
    @Test
    public void gethygg(){
        long st = System.currentTimeMillis();
        Wrapper<SharesDetail> wrd=new EntityWrapper<>();
        wrd.eq("status",88);
        List<SharesDetail> sharesDetails = sharesDetailService.selectList(wrd);

        for (SharesDetail sharesCode : sharesDetails) {
            String szorsh = sharesCode.getCode();
            String name = sharesCode.getName();
            String substring = szorsh.substring(2);
            if(substring.startsWith("688")){
                continue;
            }
            String url="https://np-anotice-stock.eastmoney.com/api/security/ann" +
                    "?cb=jQuery112303162666297121548_"+new Date().getTime()+
                    "&sr=-1&page_size=50&page_index=1&ann_type=A&client_source=web" +
                    "&stock_list="+substring+"&f_node=0&s_node=0"  ;

            try{
                HttpGet get=new HttpGet(url);
                CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
                String result = EntityUtils.toString(execute.getEntity(), "UTF-8");
                int rIndex = result.indexOf("(");
                String resultStr = result.substring(rIndex + 1, result.length() - 1);
                JSONObject datas2 = JSONObject.parseObject(resultStr);
                String data = datas2.getString("data");
                String klines = JSONObject.parseObject(data).getString("list");
                List<Object> parse = (List<Object>) JSON.parse(klines);

                List<SharesNotice> notices=new ArrayList<>();
                for (Object o : parse) {
                    SharesNotice sharesNotice=new SharesNotice();

//                    System.out.println(o.toString());
                    String notice_date = JSONObject.parseObject(o.toString()).getString("notice_date");
                    String title_ch = JSONObject.parseObject(o.toString()).getString("title_ch");
                    String columns = JSONObject.parseObject(o.toString()).getString("columns");
                    if(!StringUtil.isEmpty(columns)){
                        List<Object> columnslist = (List<Object>) JSON.parse(columns);
                        Object o1 = columnslist.get(0);
                        String column_name= JSONObject.parseObject(o1.toString()).getString("column_name");
//                        System.out.println(column_name);
                        sharesNotice.setType(column_name);
                    }


//                    System.out.println(title_ch);
//                    System.out.println(notice_date);
                    sharesNotice.setCode(szorsh);
                    sharesNotice.setTitle(title_ch);
                    sharesNotice.setTime(notice_date);
                    notices.add(sharesNotice);

                }
                sharesNoticeService.insertBatch(notices);
//                List<SharesData> sharesDatas=sharesDataService.saveCjl(parse,szorsh,name, SharesConstan.M5);
//                if(!CollectionUtils.isEmpty(sharesDatas)){
//                    sharesDataService.insertBatch(sharesDatas);
//                }
            }catch (Exception e){
                System.out.println("err");
            }
        }
        long en = System.currentTimeMillis();
        long l = (en - st)/1000;
        System.out.println(l);
    }

    /**
     * 减持增持数据
     */
    @Test
    public void getzczc(){
        long st = System.currentTimeMillis();
        Wrapper<SharesDetail> wrd=new EntityWrapper<>();
        wrd.eq("status",88);
        List<SharesDetail> sharesDetails = sharesDetailService.selectList(wrd);

        for (SharesDetail sharesCode : sharesDetails) {
            String szorsh = sharesCode.getCode();
            System.out.println(szorsh);
            String name = sharesCode.getName();
            String substring = szorsh.substring(2);
            if(substring.startsWith("688")){
                continue;
            }
            if(name.contains("sh")){
                continue;
            }
            String url="";


            url="https://datacenter-web.eastmoney.com/api/data/v1/get" +
                    "?callback=jQuery11230849410572685454_"+new Date().getTime()+
                    "&sortColumns=END_DATE%2CSECURITY_CODE%2CEITIME" +
                    "&sortTypes=-1%2C-1%2C-1&pageSize=50&pageNumber=1" +
                    "&reportName=RPT_SHARE_HOLDER_INCREASE&quoteColumns=f2~01~SECURITY_CODE~NEWEST_PRICE%2Cf3~01~SECURITY_CODE~CHANGE_RATE_QUOTES" +
                    "&columns=ALL&source=WEB&client=WEB&filter=(SECURITY_CODE%3D%22" +
                    substring +
                    "%22)";

            try{
                HttpGet get=new HttpGet(url);
                CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
                String result = EntityUtils.toString(execute.getEntity(), "UTF-8");
                int rIndex = result.indexOf("(");
                String resultStr = result.substring(rIndex + 1, result.length() - 2);
                JSONObject datas2 = JSONObject.parseObject(resultStr);
                String data = datas2.getString("result");
                String klines = JSONObject.parseObject(data).getString("data");
                List<Object> parse = (List<Object>) JSON.parse(klines);

                List<SharesDirection> notices=new ArrayList<>();
                for (Object o : parse) {
                    SharesDirection sharesDirection=new SharesDirection();
//                    System.out.println(o.toString());
                    String DIRECTION = JSONObject.parseObject(o.toString()).getString("DIRECTION");
                    String START_DATE = JSONObject.parseObject(o.toString()).getString("START_DATE");
                    String TRADE_DATE = JSONObject.parseObject(o.toString()).getString("TRADE_DATE");
                    String NOTICE_DATE = JSONObject.parseObject(o.toString()).getString("NOTICE_DATE");
                    String HOLDER_NAME = JSONObject.parseObject(o.toString()).getString("HOLDER_NAME");
                    String CHANGE_NUM = JSONObject.parseObject(o.toString()).getString("CHANGE_NUM");
                    String CHANGE_FREE_RATIO = JSONObject.parseObject(o.toString()).getString("CHANGE_FREE_RATIO");
                    sharesDirection.setChangNum(CHANGE_NUM);
                    sharesDirection.setCode(szorsh);
                    sharesDirection.setStTime(START_DATE);
                    sharesDirection.setEnTime(TRADE_DATE);
                    sharesDirection.setNoTime(NOTICE_DATE);
                    sharesDirection.setGdName(HOLDER_NAME);
                    sharesDirection.setDirection(DIRECTION);
                    sharesDirection.setZb(CHANGE_FREE_RATIO);
                    notices.add(sharesDirection);
                }
                sharesDirectionService.insertBatch(notices);
//                List<SharesData> sharesDatas=sharesDataService.saveCjl(parse,szorsh,name, SharesConstan.M5);
//                if(!CollectionUtils.isEmpty(sharesDatas)){
//                    sharesDataService.insertBatch(sharesDatas);
//                }
            }catch (Exception e){
                System.out.println("err");
            }
        }
        long en = System.currentTimeMillis();
        long l = (en - st)/1000;
        System.out.println(l);
    }

    /**
     * 行业咨询
     * 行业研报
     */
    @Test
    public void gethy() throws Exception{

        Wrapper<SharesSshy> wr=new EntityWrapper<>();
        List<SharesSshy> sharesSshies = sharesSshyService.selectList(wr);

        for (SharesSshy sharesSshy : sharesSshies) {
            String name = sharesSshy.getName();
            String html = sharesSshy.getHtml();
            String url="https://stock.eastmoney.com"+html+".html";

            HttpGet get=new HttpGet(url);
            CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
            String result = EntityUtils.toString(execute.getEntity(), "UTF-8");

            Document document = Jsoup.parse(result);
            Elements common_list = document.getElementsByClass("common_list");
            System.out.println(common_list.size());
            Element element = common_list.get(0);
            Elements li = element.getElementsByTag("li");

            List<SharesHyzx> sharesHyzxes=new ArrayList<>();
            for (Element element1 : li) {
                SharesHyzx sharesHyzx=new SharesHyzx();
                sharesHyzx.setTitle(element1.text());
                sharesHyzx.setType("行业资讯");
                sharesHyzx.setName(name);
                sharesHyzxes.add(sharesHyzx);
            }

            Element elementyb = common_list.get(2);
            Elements li1 = elementyb.getElementsByTag("li");
            for (Element element1 : li1) {
                System.out.println(element1.text());
                SharesHyzx sharesHyzx=new SharesHyzx();
                sharesHyzx.setTitle(element1.text());
                sharesHyzx.setType("行业研报");
                sharesHyzx.setName(name);
                sharesHyzxes.add(sharesHyzx);
            }
            sharesHyzxService.insertBatch(sharesHyzxes);
        }


    }

    /**
     * 保存各个行业
     */
    @Test
    public void getsyhy(){


        List<SharesSshy> sharesSshies=new ArrayList<>();
        String str=" <li class='list_code'><b>A</b></li><li class='list_li'><a href='/hangye/hy735.html' title='安防设备' >安防设备</a></li><li class='list_code'><b>B</b></li><li class='list_li'><a href='/hangye/hy474.html' title='保险' >保险</a></li><li class='list_li'><a href='/hangye/hy546.html' title='玻璃玻纤' >玻璃玻纤</a></li><li class='list_li'><a href='/hangye/hy733.html' title='包装材料' >包装材料</a></li><li class='list_code'><b>C</b></li><li class='list_li'><a href='/hangye/hy537.html' title='材料行业' >材料行业</a></li><li class='list_li'><a href='/hangye/hy729.html' title='船舶制造' >船舶制造</a></li><li class='list_li'><a href='/hangye/hy1017.html' title='采掘行业' >采掘行业</a></li><li class='list_code'><b>D</b></li><li class='list_li'><a href='/hangye/hy428.html' title='电力行业' >电力行业</a></li><li class='list_li'><a href='/hangye/hy447.html' title='电子信息' >电子信息</a></li><li class='list_li'><a href='/hangye/hy459.html' title='电子元件' >电子元件</a></li><li class='list_li'><a href='/hangye/hy736.html' title='电信运营' >电信运营</a></li><li class='list_li'><a href='/hangye/hy738.html' title='多元金融' >多元金融</a></li><li class='list_code'><b>F</b></li><li class='list_li'><a href='/hangye/hy436.html' title='纺织服装' >纺织服装</a></li><li class='list_li'><a href='/hangye/hy451.html' title='房地产' >房地产</a></li><li class='list_li'><a href='/hangye/hy1020.html' title='非金属材料' >非金属材料</a></li><li class='list_code'><b>G</b></li><li class='list_li'><a href='/hangye/hy421.html' title='高速公路' >高速公路</a></li><li class='list_li'><a href='/hangye/hy425.html' title='工程建设' >工程建设</a></li><li class='list_li'><a href='/hangye/hy427.html' title='公用事业' >公用事业</a></li><li class='list_li'><a href='/hangye/hy440.html' title='工艺商品' >工艺商品</a></li><li class='list_li'><a href='/hangye/hy450.html' title='港口水运' >港口水运</a></li><li class='list_li'><a href='/hangye/hy479.html' title='钢铁行业' >钢铁行业</a></li><li class='list_li'><a href='/hangye/hy484.html' title='国际贸易' >国际贸易</a></li><li class='list_li'><a href='/hangye/hy726.html' title='工程咨询服务' >工程咨询服务</a></li><li class='list_li'><a href='/hangye/hy732.html' title='贵金属' >贵金属</a></li><li class='list_code'><b>H</b></li><li class='list_li'><a href='/hangye/hy471.html' title='化纤行业' >化纤行业</a></li><li class='list_li'><a href='/hangye/hy480.html' title='航天航空' >航天航空</a></li><li class='list_li'><a href='/hangye/hy538.html' title='化学制品' >化学制品</a></li><li class='list_li'><a href='/hangye/hy728.html' title='环保行业' >环保行业</a></li><li class='list_li'><a href='/hangye/hy731.html' title='化肥行业' >化肥行业</a></li><li class='list_li'><a href='/hangye/hy1019.html' title='化学原料' >化学原料</a></li><li class='list_code'><b>J</b></li><li class='list_li'><a href='/hangye/hy422.html' title='交运物流' >交运物流</a></li><li class='list_li'><a href='/hangye/hy429.html' title='交运设备' >交运设备</a></li><li class='list_li'><a href='/hangye/hy456.html' title='家电行业' >家电行业</a></li><li class='list_li'><a href='/hangye/hy545.html' title='机械行业' >机械行业</a></li><li class='list_li'><a href='/hangye/hy739.html' title='金属制品' >金属制品</a></li><li class='list_code'><b>L</b></li><li class='list_li'><a href='/hangye/hy485.html' title='旅游酒店' >旅游酒店</a></li><li class='list_code'><b>M</b></li><li class='list_li'><a href='/hangye/hy420.html' title='民航机场' >民航机场</a></li><li class='list_li'><a href='/hangye/hy437.html' title='煤炭行业' >煤炭行业</a></li><li class='list_code'><b>N</b></li><li class='list_li'><a href='/hangye/hy433.html' title='农牧饲渔' >农牧饲渔</a></li><li class='list_li'><a href='/hangye/hy477.html' title='酿酒行业' >酿酒行业</a></li><li class='list_li'><a href='/hangye/hy730.html' title='农药兽药' >农药兽药</a></li><li class='list_li'><a href='/hangye/hy1015.html' title='能源金属' >能源金属</a></li><li class='list_code'><b>Q</b></li><li class='list_li'><a href='/hangye/hy473.html' title='券商信托' >券商信托</a></li><li class='list_li'><a href='/hangye/hy481.html' title='汽车零部件' >汽车零部件</a></li><li class='list_li'><a href='/hangye/hy1016.html' title='汽车服务' >汽车服务</a></li><li class='list_li'><a href='/hangye/hy1029.html' title='汽车整车' >汽车整车</a></li><li class='list_code'><b>R</b></li><li class='list_li'><a href='/hangye/hy737.html' title='软件服务' >软件服务</a></li><li class='list_li'><a href='/hangye/hy1028.html' title='燃气' >燃气</a></li><li class='list_code'><b>S</b></li><li class='list_li'><a href='/hangye/hy424.html' title='水泥建材' >水泥建材</a></li><li class='list_li'><a href='/hangye/hy438.html' title='食品饮料' >食品饮料</a></li><li class='list_li'><a href='/hangye/hy454.html' title='塑料制品' >塑料制品</a></li><li class='list_li'><a href='/hangye/hy457.html' title='输配电气' >输配电气</a></li><li class='list_li'><a href='/hangye/hy464.html' title='石油行业' >石油行业</a></li><li class='list_li'><a href='/hangye/hy482.html' title='商业百货' >商业百货</a></li><li class='list_code'><b>T</b></li><li class='list_li'><a href='/hangye/hy448.html' title='通讯行业' >通讯行业</a></li><li class='list_code'><b>W</b></li><li class='list_li'><a href='/hangye/hy486.html' title='文化传媒' >文化传媒</a></li><li class='list_li'><a href='/hangye/hy740.html' title='文教休闲' >文教休闲</a></li><li class='list_code'><b>X</b></li><li class='list_li'><a href='/hangye/hy1018.html' title='橡胶制品' >橡胶制品</a></li><li class='list_li'><a href='/hangye/hy1027.html' title='小金属' >小金属</a></li><li class='list_code'><b>Y</b></li><li class='list_li'><a href='/hangye/hy458.html' title='仪器仪表' >仪器仪表</a></li><li class='list_li'><a href='/hangye/hy465.html' title='医药制造' >医药制造</a></li><li class='list_li'><a href='/hangye/hy475.html' title='银行' >银行</a></li><li class='list_li'><a href='/hangye/hy478.html' title='有色金属' >有色金属</a></li><li class='list_li'><a href='/hangye/hy727.html' title='医疗行业' >医疗行业</a></li><li class='list_code'><b>Z</b></li><li class='list_li'><a href='/hangye/hy470.html' title='造纸印刷' >造纸印刷</a></li><li class='list_li'><a href='/hangye/hy476.html' title='装修建材' >装修建材</a></li><li class='list_li'><a href='/hangye/hy539.html' title='综合行业' >综合行业</a></li><li class='list_li'><a href='/hangye/hy725.html' title='装修装饰' >装修装饰</a></li><li class='list_li'><a href='/hangye/hy734.html' title='珠宝首饰' >珠宝首饰</a></li><li class='list_li'><a href='/hangye/hy910.html' title='专用设备' >专用设备</a></li>";
        String[] split = str.split("href=");
        for (String s : split) {
            if(s.contains("title")){
                SharesSshy sharesSshy = new SharesSshy();
                System.out.println(s.split("</a>")[0]);
                String[] split1 = s.split("</a>")[0].split(".html");
                System.out.println(split1[0].replace("'", ""));
                String[] split2 = split1[1].split(">");
                System.out.println(split2[1].trim());
                sharesSshy.setHtml(split1[0].replace("'", ""));
                sharesSshy.setName(split2[1].trim());
                sharesSshies.add(sharesSshy);
            }
        }

        sharesSshyService.insertBatch(sharesSshies);
        
    }

    /**
     * 并购重组
     */
    @Test
    public  void bgcz() throws  Exception{

        for (int i=1;i<30;i++){
            String url="https://datacenter-web.eastmoney.com/api/data/get" +
                    "?callback=jQuery11230429379404784511_"+new Date().getTime()+
                    "&st=SCGGRQ&sr=-1&ps=50&p=" +
                    i +
                    "&sty=ALL&source=WEB" +
                    "&token=894050c76af8597a853f5b408b759f5d" +
                    "&type=RPTA_WEB_BGCZMX";

            try {
                HttpGet get=new HttpGet(url);
                CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
                String result = EntityUtils.toString(execute.getEntity(), "UTF-8");
                int rIndex = result.indexOf("(");
                String resultStr = result.substring(rIndex + 1, result.length() - 2);
                JSONObject datas2 = JSONObject.parseObject(resultStr);
                String data = datas2.getString("result");
                String klines = JSONObject.parseObject(data).getString("data");
                List<Object> parse = (List<Object>) JSON.parse(klines);

                List<SharesBgcz> sharesBgczs=new ArrayList<>();
                for (Object o : parse) {
                    SharesBgcz sharesBgcz=new SharesBgcz()  ;
                    String announdate = JSONObject.parseObject(o.toString()).getString("ANNOUNDATE");
                    String G_GOMNAME = JSONObject.parseObject(o.toString()).getString("G_GOMNAME");
                    String H_COMNAME = JSONObject.parseObject(o.toString()).getString("H_COMNAME");
                    String ZRFS = JSONObject.parseObject(o.toString()).getString("ZRFS");
                    String S_COMNAME = JSONObject.parseObject(o.toString()).getString("S_COMNAME");
                    String SCGGRQ = JSONObject.parseObject(o.toString()).getString("SCGGRQ");
                    String SCODE = JSONObject.parseObject(o.toString()).getString("SCODE");
                    String OBJTYPE = JSONObject.parseObject(o.toString()).getString("OBJTYPE");
                    String JYJE = JSONObject.parseObject(o.toString()).getString("JYJE");
                    sharesBgcz.setJyje(JYJE);
                    sharesBgcz.setCode(SCODE);
                    sharesBgcz.setObjType(OBJTYPE);
                    sharesBgcz.setNoTime(SCGGRQ);

                    if(!StringUtil.isEmpty(S_COMNAME)){
                        if(S_COMNAME.length()>50){
                            sharesBgcz.setSGomname(S_COMNAME.substring(0,50));
                        }else{
                            sharesBgcz.setSGomname(S_COMNAME);
                        }
                    }

                    if(!StringUtil.isEmpty(H_COMNAME)){
                        if(H_COMNAME.length()>50){
                            sharesBgcz.setHGomname(H_COMNAME.substring(0,50));
                        }else{
                            sharesBgcz.setHGomname(H_COMNAME);
                        }
                    }

                    if(!StringUtil.isEmpty(G_GOMNAME)){
                        if(G_GOMNAME.length()>50){
                            sharesBgcz.setGGomname(G_GOMNAME.substring(0,50));
                        }else{
                            sharesBgcz.setGGomname(G_GOMNAME);
                        }
                    }
                    sharesBgcz.setTime(announdate);
                    sharesBgcz.setType(ZRFS);
                    sharesBgczs.add(sharesBgcz);
                }
                sharesBgczService.insertBatch(sharesBgczs);
            }catch (Exception e){
                    e.printStackTrace();
            }
        }


        

    }

    /**
     * 股东季报数据
     */
    @Test
    public void getgdchange(){

        Wrapper<SharesDetail> wr=new EntityWrapper<>();
        wr.eq("status",88);
        List<SharesDetail> sharesDetails = sharesDetailService.selectList(wr);
        for (SharesDetail sharesDetail : sharesDetails) {

            try {
                String code = sharesDetail.getCode();
                String name = sharesDetail.getName();
                String url="http://emweb.securities.eastmoney.com/PC_HSF10/ShareholderResearch/PageAjax" +
                        "?code=" +
                        code.toUpperCase().trim();
                HttpGet get=new HttpGet(url);
                CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
                String result = EntityUtils.toString(execute.getEntity(), "UTF-8");
                JSONObject datas2 = JSONObject.parseObject(result);
                String gdrs = datas2.getString("gdrs");
                List<Object> parse = (List<Object>) JSON.parse(gdrs);

                List<SharesGdChange> sharesGdChanges=new ArrayList<>();
                for (Object o : parse) {
                    SharesGdChange  sharesGdChange=new SharesGdChange()  ;
                    String AVG_FREESHARES_RATIO = JSONObject.parseObject(o.toString()).getString("AVG_FREESHARES_RATIO");
                    String AVG_FREE_SHARES = JSONObject.parseObject(o.toString()).getString("AVG_FREE_SHARES");
                    String AVG_HOLD_AMT = JSONObject.parseObject(o.toString()).getString("AVG_HOLD_AMT");
                    String END_DATE = JSONObject.parseObject(o.toString()).getString("END_DATE");
                    String FREEHOLD_RATIO_TOTAL = JSONObject.parseObject(o.toString()).getString("FREEHOLD_RATIO_TOTAL");
                    String HOLDER_TOTAL_NUM = JSONObject.parseObject(o.toString()).getString("HOLDER_TOTAL_NUM");
                    String HOLD_FOCUS = JSONObject.parseObject(o.toString()).getString("HOLD_FOCUS");
                    String HOLD_RATIO_TOTAL = JSONObject.parseObject(o.toString()).getString("HOLD_RATIO_TOTAL");
                    String PRICE = JSONObject.parseObject(o.toString()).getString("PRICE");
                    String SECUCODE = JSONObject.parseObject(o.toString()).getString("SECUCODE");
                    String SECURITY_CODE = JSONObject.parseObject(o.toString()).getString("SECURITY_CODE");
                    String TOTAL_NUM_RATIO = JSONObject.parseObject(o.toString()).getString("TOTAL_NUM_RATIO");

                    sharesGdChange.setAvgFreesharesRatio(AVG_FREESHARES_RATIO);
                    sharesGdChange.setAvgFreeShares(AVG_FREE_SHARES);
                    sharesGdChange.setAvgHoldAmt(AVG_HOLD_AMT);
                    sharesGdChange.setEndDate(END_DATE);
                    sharesGdChange.setFreeholdRatioTotal(FREEHOLD_RATIO_TOTAL);
                    sharesGdChange.setHolderTotalNum(HOLDER_TOTAL_NUM);
                    sharesGdChange.setHoldFocus(HOLD_FOCUS);
                    sharesGdChange.setHoldRatioTotal(HOLD_RATIO_TOTAL);
                    sharesGdChange.setPrice(PRICE);
                    sharesGdChange.setCode(code);
                    sharesGdChange.setName(name);
                    sharesGdChange.setTotalNumRatio(TOTAL_NUM_RATIO);

                    sharesGdChanges.add(sharesGdChange);

                }
                sharesGdChangeService.insertBatch(sharesGdChanges);

            }catch (Exception e){
                e.printStackTrace();
            }

        }
//        sharesGdChangeService
    }

    /**
     * 股东最新数据
     */
    @Test
    public void getgdnum(){

        Wrapper<SharesGdnum> wr=new EntityWrapper<>();
        sharesGdnumService.delete(wr);

        for (int i=0;i<=92;i++){
            String url="https://datacenter-web.eastmoney.com/api/data/v1/get" +
                    "?callback=jQuery112307238029174965088_"+new Date().getTime()+
                    "&sortColumns=HOLD_NOTICE_DATE" +
                    "%2CSECURITY_CODE&sortTypes=-1%2C-1&pageSize=50" +
                    "&pageNumber=" +
                    i +
                    "&reportName=RPT_HOLDERNUMLATEST" +
                    "&columns=SECURITY_CODE%2CSECURITY_NAME_ABBR" +
                    "%2CEND_DATE%2CINTERVAL_CHRATE%2CAVG_MARKET_CAP%2CAVG_HOLD_NUM" +
                    "%2CTOTAL_MARKET_CAP%2CTOTAL_A_SHARES%2CHOLD_NOTICE_DATE%2CHOLDER_NUM" +
                    "%2CPRE_HOLDER_NUM%2CHOLDER_NUM_CHANGE%2CHOLDER_NUM_RATIO%2CEND_DATE" +
                    "%2CPRE_END_DATE&quoteColumns=f2%2Cf3&source=WEB&client=WEB";

            try {
                HttpGet get=new HttpGet(url);
                CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
                String result = EntityUtils.toString(execute.getEntity(), "UTF-8");
                int rIndex = result.indexOf("(");
                String resultStr = result.substring(rIndex + 1, result.length() - 2);
                JSONObject datas2 = JSONObject.parseObject(resultStr);
                String data = datas2.getString("result");
                String klines = JSONObject.parseObject(data).getString("data");
                List<Object> parse = (List<Object>) JSON.parse(klines);

                List<SharesGdnum> sharesGdnums=new ArrayList<>();
                for (Object o : parse) {
                    SharesGdnum sharesBgcz=new SharesGdnum()  ;
                    String HOLDER_NUM = JSONObject.parseObject(o.toString()).getString("HOLDER_NUM");
                    String END_DATE = JSONObject.parseObject(o.toString()).getString("END_DATE");
                    String HOLDER_NUM_CHANGE = JSONObject.parseObject(o.toString()).getString("HOLDER_NUM_CHANGE");
                    String HOLDER_NUM_RATIO = JSONObject.parseObject(o.toString()).getString("HOLDER_NUM_RATIO");
                    String HOLD_NOTICE_DATE = JSONObject.parseObject(o.toString()).getString("HOLD_NOTICE_DATE");
                    String PRE_END_DATE = JSONObject.parseObject(o.toString()).getString("PRE_END_DATE");
                    String PRE_HOLDER_NUM = JSONObject.parseObject(o.toString()).getString("PRE_HOLDER_NUM");
                    String SECURITY_CODE = JSONObject.parseObject(o.toString()).getString("SECURITY_CODE");
                    String SECURITY_NAME_ABBR = JSONObject.parseObject(o.toString()).getString("SECURITY_NAME_ABBR");
                    String TOTAL_A_SHARES = JSONObject.parseObject(o.toString()).getString("TOTAL_A_SHARES");
                    String f2 = JSONObject.parseObject(o.toString()).getString("f2");
                    String f3 = JSONObject.parseObject(o.toString()).getString("f3");
                    String AVG_HOLD_NUM = JSONObject.parseObject(o.toString()).getString("AVG_HOLD_NUM");
                    String AVG_MARKET_CAP = JSONObject.parseObject(o.toString()).getString("AVG_MARKET_CAP");

                    sharesBgcz.setAvgHoldNum(AVG_HOLD_NUM);
                    sharesBgcz.setAvgMarketCap(AVG_MARKET_CAP);
                    sharesBgcz.setF2(f2);
                    sharesBgcz.setF3(f3);
                    sharesBgcz.setEndDate(END_DATE);
                    sharesBgcz.setTotalAShares(TOTAL_A_SHARES);
                    sharesBgcz.setName(SECURITY_NAME_ABBR);
                    sharesBgcz.setCode(SECURITY_CODE);
                    sharesBgcz.setPreEndDate(PRE_END_DATE);
                    sharesBgcz.setPreHolderNum(PRE_HOLDER_NUM   );
                    sharesBgcz.setHolderNum(HOLDER_NUM);
                    sharesBgcz.setHolderNumChange(HOLDER_NUM_CHANGE);
                    sharesBgcz.setHolderNumRatio(HOLDER_NUM_RATIO);
                    sharesBgcz.setHoldNoticeDate(HOLD_NOTICE_DATE);
                    sharesGdnums.add(sharesBgcz);
                }
                sharesGdnumService.insertBatch(sharesGdnums);
            }catch ( Exception e){
                    e.printStackTrace();
            }
        }

    }

    /**
     * 业绩报告
     */
    @Test
    public void getyjbg(){

        for (int i=0;i<=103;i++){
            String url="https://datacenter-web.eastmoney.com/api/data/v1/get" +
                    "?callback=jQuery112307238029174965088_"+new Date().getTime()+
                    "&sortColumns=HOLD_NOTICE_DATE" +
                    "%2CSECURITY_CODE&sortTypes=-1%2C-1&pageSize=50" +
                    "&pageNumber=" +
                    i +
                    "&reportName=RPT_HOLDERNUMLATEST" +
                    "&columns=SECURITY_CODE%2CSECURITY_NAME_ABBR" +
                    "%2CEND_DATE%2CINTERVAL_CHRATE%2CAVG_MARKET_CAP%2CAVG_HOLD_NUM" +
                    "%2CTOTAL_MARKET_CAP%2CTOTAL_A_SHARES%2CHOLD_NOTICE_DATE%2CHOLDER_NUM" +
                    "%2CPRE_HOLDER_NUM%2CHOLDER_NUM_CHANGE%2CHOLDER_NUM_RATIO%2CEND_DATE" +
                    "%2CPRE_END_DATE&quoteColumns=f2%2Cf3&source=WEB&client=WEB";

            url="https://datacenter-web.eastmoney.com/api/data/get?callback" +
                    "=jQuery112307253209228731203_"+new Date().getTime()+
                    "&st=UPDATE_DATE%2CSECURITY_CODE&sr=-1%2C-1&ps=50&p=" +
                    i +
                    "&type=RPT_LICO_FN_CPD&sty=ALL" +
                    "&token=894050c76af8597a853f5b408b759f5d&filter=(REPORTDATE%3D%272021-09-30%27)";

            try {
                HttpGet get=new HttpGet(url);
                CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
                String result = EntityUtils.toString(execute.getEntity(), "UTF-8");
                int rIndex = result.indexOf("(");
                String resultStr = result.substring(rIndex + 1, result.length() - 2);
                JSONObject datas2 = JSONObject.parseObject(resultStr);
                String data = datas2.getString("result");
                String klines = JSONObject.parseObject(data).getString("data");
                List<Object> parse = (List<Object>) JSON.parse(klines);

                List<SharesYjbg> sharesYjbgs=new ArrayList<>();
                for (Object o : parse) {


                    SharesYjbg sharesYjbg=new SharesYjbg()  ;
                    String ASSIGNDSCRPT = JSONObject.parseObject(o.toString()).getString("ASSIGNDSCRPT");
                    String NOTICE_DATE = JSONObject.parseObject(o.toString()).getString("NOTICE_DATE");
                    String BASICEPS = JSONObject.parseObject(o.toString()).getString("BASIC_EPS");
                    String BPS = JSONObject.parseObject(o.toString()).getString("BPS");
                    String DEDUCTBASICEPS = JSONObject.parseObject(o.toString()).getString("DEDUCT_BASIC_EPS");
                    String EITIME = JSONObject.parseObject(o.toString()).getString("EITIME");
                    String ISNEW = JSONObject.parseObject(o.toString()).getString("ISNEW");
                    String MGJYXJJE = JSONObject.parseObject(o.toString()).getString("MGJYXJJE");
                    String ORGCODE = JSONObject.parseObject(o.toString()).getString("ORG_CODE");
                    String PARENTNETPROFIT = JSONObject.parseObject(o.toString()).getString("PARENT_NETPROFIT");
                    String PAYYEAR = JSONObject.parseObject(o.toString()).getString("PAYYEAR");
                    String QDATE = JSONObject.parseObject(o.toString()).getString("QDATE");
                    String REPORTDATE = JSONObject.parseObject(o.toString()).getString("REPORTDATE");
                    String SJLHZ = JSONObject.parseObject(o.toString()).getString("SJLHZ");
                    String SJLTZ = JSONObject.parseObject(o.toString()).getString("SJLTZ");
                    String TOTALOPERATEINCOME = JSONObject.parseObject(o.toString()).getString("TOTAL_OPERATE_INCOME");
                    String UPDATEDATE = JSONObject.parseObject(o.toString()).getString("UPDATE_DATE");
                    String WEIGHTAVGROE = JSONObject.parseObject(o.toString()).getString("WEIGHTAVG_ROE");
                    String XSMLL = JSONObject.parseObject(o.toString()).getString("XSMLL");
                    String YSHZ = JSONObject.parseObject(o.toString()).getString("YSHZ");
                    String YSTZ = JSONObject.parseObject(o.toString()).getString("YSTZ");
                    String ZXGXL = JSONObject.parseObject(o.toString()).getString("ZXGXL");
                    String SECURITY_NAME_ABBR = JSONObject.parseObject(o.toString()).getString("SECURITY_NAME_ABBR");
                    String SECURITY_CODE = JSONObject.parseObject(o.toString()).getString("SECURITY_CODE");

                    sharesYjbg.setBasicEps(BASICEPS);
                    sharesYjbg.setCode(SECURITY_CODE);
                    sharesYjbg.setName(SECURITY_NAME_ABBR);
                    sharesYjbg.setDeductBasicEps(DEDUCTBASICEPS);
                    sharesYjbg.setBps(BPS);
                    sharesYjbg.setAssigndscrpt(ASSIGNDSCRPT);
                    sharesYjbg.setParentNetprofit(PARENTNETPROFIT);
                    sharesYjbg.setOrgCode(ORGCODE);
                    sharesYjbg.setNoticeDate(NOTICE_DATE);
                    sharesYjbg.setMgjyxjje(MGJYXJJE);
                    sharesYjbg.setIsnew(ISNEW);
                    sharesYjbg.setEitime(EITIME);
                    sharesYjbg.setZxgxl(ZXGXL);
                    sharesYjbg.setYstz(YSTZ);
                    sharesYjbg.setYshz(YSHZ);
                    sharesYjbg.setXsmll(XSMLL);
                    sharesYjbg.setWeightavgRoe(WEIGHTAVGROE);
                    sharesYjbg.setUpdateDate(UPDATEDATE);
                    sharesYjbg.setTotalOperateIncome(TOTALOPERATEINCOME);
                    sharesYjbg.setSjltz(SJLTZ);
                    sharesYjbg.setSjlhz(SJLHZ);
                    sharesYjbg.setReportdate(REPORTDATE );
                    sharesYjbg.setQdate(QDATE);
                    sharesYjbg.setPayyear(PAYYEAR);

                    sharesYjbgs.add(sharesYjbg);

                }
                sharesYjbgService.insertBatch(sharesYjbgs);
            }catch ( Exception e){
                e.printStackTrace();
            }
        }

    }

    /**
     * 业绩预告
     */
    @Test
    public void  getyjjg(){
        for (int i=1;i<=55;i++){
            String url="https://datacenter-web.eastmoney.com/securities/api/data/v1/get?" +
                    "callback=jQuery112303693696026887163_"+new Date().getTime()+
                    "&sortColumns=NOTICE_DATE%2CSECURITY_CODE&sortTypes=-1%2C-1&pageSize=50&" +
                    "pageNumber=" +
                    i +
                    "&reportName=RPT_PUBLIC_OP_NEWPREDICT&columns=ALL" +
                    "&token=894050c76af8597a853f5b408b759f5d&filter=(REPORT_DATE%3D%272021-09-30%27)";

            try {
                HttpGet get=new HttpGet(url);
                CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
                String result = EntityUtils.toString(execute.getEntity(), "UTF-8");
                int rIndex = result.indexOf("(");
                String resultStr = result.substring(rIndex + 1, result.length() - 2);
                JSONObject datas2 = JSONObject.parseObject(resultStr);
                String data = datas2.getString("result");
                String klines = JSONObject.parseObject(data).getString("data");
                List<Object> parse = (List<Object>) JSON.parse(klines);

                List<SharesYjyg> sharesYjygs=new ArrayList<>();
                for (Object o : parse) {
                    //        : -17.86

                    SharesYjyg sharesYjyg=new SharesYjyg();

                    String ADD_AMP_LOWER = JSONObject.parseObject(o.toString()).getString("ADD_AMP_LOWER");
                    String ADD_AMP_UPPER = JSONObject.parseObject(o.toString()).getString("ADD_AMP_UPPER");
                    String CHANGE_REASON_EXPLAIN = JSONObject.parseObject(o.toString()).getString("CHANGE_REASON_EXPLAIN");
                    String FORECAST_JZ = JSONObject.parseObject(o.toString()).getString("FORECAST_JZ");
                    String FORECAST_STATE = JSONObject.parseObject(o.toString()).getString("FORECAST_STATE");
                    String INCREASE_JZ = JSONObject.parseObject(o.toString()).getString("INCREASE_JZ");
                    String IS_LATEST = JSONObject.parseObject(o.toString()).getString("IS_LATEST");
                    String NOTICE_DATE = JSONObject.parseObject(o.toString()).getString("NOTICE_DATE");
                    String ORG_CODE = JSONObject.parseObject(o.toString()).getString("ORG_CODE");
                    String PREDICT_AMT_LOWER = JSONObject.parseObject(o.toString()).getString("PREDICT_AMT_LOWER");
                    String PREDICT_AMT_UPPER = JSONObject.parseObject(o.toString()).getString("PREDICT_AMT_UPPER");
                    String PREDICT_CONTENT = JSONObject.parseObject(o.toString()).getString("PREDICT_CONTENT");
                    String PREDICT_FINANCE = JSONObject.parseObject(o.toString()).getString("PREDICT_FINANCE");
                    String PREDICT_FINANCE_CODE = JSONObject.parseObject(o.toString()).getString("PREDICT_FINANCE_CODE");
                    String PREDICT_TYPE = JSONObject.parseObject(o.toString()).getString("PREDICT_TYPE");
                    String PREYEAR_SAME_PERIOD = JSONObject.parseObject(o.toString()).getString("PREYEAR_SAME_PERIOD");
                    String REPORT_DATE = JSONObject.parseObject(o.toString()).getString("REPORT_DATE");
                    String SECURITY_NAME_ABBR = JSONObject.parseObject(o.toString()).getString("SECURITY_NAME_ABBR");
                    String SECURITY_CODE = JSONObject.parseObject(o.toString()).getString("SECURITY_CODE");

                    sharesYjyg.setForecastState(FORECAST_STATE);
                    sharesYjyg.setForecastJz(FORECAST_JZ);
                    if(!StringUtil.isEmpty(CHANGE_REASON_EXPLAIN)){
                        if(CHANGE_REASON_EXPLAIN.length()>50){
                            sharesYjyg.setChangeReasonExplain(CHANGE_REASON_EXPLAIN.substring(0,50));
                        }else {
                            sharesYjyg.setChangeReasonExplain(CHANGE_REASON_EXPLAIN);
                        }
                    }

                    sharesYjyg.setAddAmpLower(ADD_AMP_LOWER);
                    sharesYjyg.setAddAmpUpper(ADD_AMP_UPPER);
                    sharesYjyg.setOrgCode(ORG_CODE);
                    sharesYjyg.setNoticeDate(NOTICE_DATE);
                    sharesYjyg.setIsLatest(IS_LATEST);
                    sharesYjyg.setIncreaseJz(INCREASE_JZ);


                    sharesYjyg.setCode(SECURITY_CODE);
                    sharesYjyg.setName(SECURITY_NAME_ABBR);
                    sharesYjyg.setReportDate(REPORT_DATE);
                    sharesYjyg.setPreyearSamePeriod(PREYEAR_SAME_PERIOD);
                    sharesYjyg.setPredictType(PREDICT_TYPE);
                    sharesYjyg.setPredictFinanceCode(PREDICT_FINANCE_CODE);
                    sharesYjyg.setPredictFinance(PREDICT_FINANCE);
                    sharesYjyg.setPredictContent(PREDICT_CONTENT);
                    sharesYjyg.setPredictAmtUpper(PREDICT_AMT_UPPER);
                    sharesYjyg.setPredictAmtLower(PREDICT_AMT_LOWER);

                    sharesYjygs.add(sharesYjyg);
                }

                sharesYjygService.insertBatch(sharesYjygs);
            }catch (Exception e){
                e.printStackTrace();
            }

        }
    }

    /**
     * 业绩预告
     */
    @Test
    public void getyjyg(){
//        Wrapper<SharesYjyg> wrjg=new EntityWrapper<>();
//        wrjg.orderBy("noticeDate",false);
//        List<SharesYjyg> sharesYjygs = sharesYjygService.selectList(wrjg);

        sharesYjygService.getyjyg();
    }

    /**
     * 所有数据更新
     */
    @Test
    public  void gethyzxall(){
        shareHolderService.updateShares();
    }

    @Test
    public void  getzjlx() throws  Exception{
        System.out.println("查询资金流向 start");
//        shareHolderService.getzjlx();
//        shareHolderService.gethyssl();
        shareHolderService.gethyzx();
        System.out.println("查询资金流向 end");
    }

    /**
     * 行业与个股的关系
     */
    @Test
    public void gethyVsgg(){
        String url="http://push2.eastmoney.com/api/qt/slist/get?spt=1&np=3&fltt=2&invt=2&fields=f9,f12,f13,f14,f20,f23,f37,f45,f49,f134,f135,f129,f1000,f2000,f3000&ut=bd1d9ddb04089700cf9c27f6f7426281&cb=jQuery1124009589982267392894_1637648022721&secid=0.300481&_=1637648022722";
    }

    /**
     * 有多少个概念
     */
    @Test
    public void getSsgn(){

//        sharesSsgnService.

        for(int i=1;i<18;i++){

            String url="http://4.push2.eastmoney.com/api/qt/clist/get" +
                    "?cb=jQuery1124037468268543266015_"+new Date().getTime()+
                    "&pn=" +
                    i +
                    "&pz=20&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2" +
                    "&invt=2&fid=f3&fs=m:90+t:3+f:!50" +
                    "&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f26,f22" +
                    ",f33,f11,f62,f128,f136,f115,f152,f124,f107,f104,f105,f140,f141,f207,f208,f209," +
                    "f222&_="+new Date().getTime();

            try {
                HttpGet get=new HttpGet(url);
                CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
                String result = EntityUtils.toString(execute.getEntity(), "UTF-8");
                int rIndex = result.indexOf("(");
                String resultStr = result.substring(rIndex + 1, result.length() - 2);
                JSONObject datas2 = JSONObject.parseObject(resultStr);
                String data = datas2.getString("data");
                String klines = JSONObject.parseObject(data).getString("diff");
                List<Object> parse = (List<Object>) JSON.parse(klines);
                List<SharesSsgn> sharesSsgns=new ArrayList<>();
                for (Object o : parse) {
                    System.out.println(o.toString());
                    String f12 = JSONObject.parseObject(o.toString()).getString("f12");
                    String f14 = JSONObject.parseObject(o.toString()).getString("f14");
                    SharesSsgn sharesSsgn=new SharesSsgn()  ;
                    sharesSsgn.setCode(f12);
                    sharesSsgn.setName(f14);
                    sharesSsgns.add(sharesSsgn);
                }
                if(!CollectionUtils.isEmpty(sharesSsgns)){
                    sharesSsgnService.insertBatch(sharesSsgns);
                }
                    //        : -17.86
            }catch (Exception e){
                e.printStackTrace();
            }

        }
    }

    /**
     * 根据所属概念查询股票，
     */
    @Test
    public void getsharesgn(){
        Wrapper<SharesSsgn> wr=new EntityWrapper<>();
        List<SharesSsgn> voList = sharesSsgnService.selectList(wr);
        for (SharesSsgn sharesSsgn : voList) {

            List<SharesGn> gns=new ArrayList<>();
            System.out.println(sharesSsgn.getCode());
            for (int i = 1; i < 99; i++) {
                String url = "http://50.push2.eastmoney.com/api/qt/clist/get" +
                        "?cb=jQuery112401417904202915563_" + new Date().getTime() +
                        "&pn=" +
                        i +
                        "&pz=20&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2" +
                        "&invt=2&fid=f3&fs=b:" + sharesSsgn.getCode() + "+f:!50" +
                        "&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25," +
                        "f22,f11,f62,f128,f136,f115,f152,f45&_=" + new Date().getTime();


                try {
                    HttpGet get = new HttpGet(url);
                    CloseableHttpResponse execute = HttpClient5Utils.httpclient.execute(get);
                    String result = EntityUtils.toString(execute.getEntity(), "UTF-8");
                    int rIndex = result.indexOf("(");
                    String resultStr = result.substring(rIndex + 1, result.length() - 2);
                    JSONObject datas2 = JSONObject.parseObject(resultStr);
                    String data = datas2.getString("data");
                    String klines = JSONObject.parseObject(data).getString("diff");
                    Integer total = JSONObject.parseObject(data).getInteger("total");
                    List<Object> parse = (List<Object>) JSON.parse(klines);

                    for (Object o : parse) {
                        String f12 = JSONObject.parseObject(o.toString()).getString("f12");
                        String f14 = JSONObject.parseObject(o.toString()).getString("f14");
                        SharesGn sharesGn=new SharesGn();
                        sharesGn.setSharesCode(f12);
                        sharesGn.setSharesName(f14);
                        sharesGn.setSsgnId(sharesSsgn.getId());
                        sharesGn.setSsgnName(sharesSsgn.getName());
                        gns.add(sharesGn);
                    }

                    if(!CollectionUtils.isEmpty(gns)){
                        if(gns.size()==total){
                            break;
                        }
                    }

                    //29
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            if(!CollectionUtils.isEmpty(gns)){
                sharesGnService.insertBatch(gns);
            }
        }
    }

    /**
     * 记录股票概念
     */
    @Test
    public void getsavessg(){
        Wrapper<SharesDetail> wr=new EntityWrapper<>();
        List<SharesDetail> sharesDetails = sharesDetailService.selectList(wr);
        for (SharesDetail sharesDetail : sharesDetails) {
            String code = sharesDetail.getCode();
            System.out.println(code);
            Wrapper<SharesGn> wrgn=new EntityWrapper<>();
            wrgn.eq("shares_code",code.substring(2));
            List<SharesGn> gns = sharesGnService.selectList(wrgn);
            if(!CollectionUtils.isEmpty(gns)){
                List<Integer> intList=new ArrayList<>();
                List<String> sList=new ArrayList<>();
                for (SharesGn gn : gns) {
                    Integer ssgnId = gn.getSsgnId();
                    String ssgnName = gn.getSsgnName();
                    intList.add(ssgnId);
                    sList.add(ssgnName);
                }
                String s = JSONObject.toJSONString(sList);
                sharesDetail.setSsgn(s);
                sharesDetailService.updateById(sharesDetail);
            }
        }
    }
}
